package com.lwm.mapper;

import com.lwm.domain.DeliveryOrder;
import com.lwm.dto.DeliveryOrderDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeliveryOrderMapper {
    /**
     * 插入
     *
     * @param deliveryOrder 交货订单
     * @return {@link Integer}
     */
    Integer insert(DeliveryOrder deliveryOrder);

    /**
     * 删除一批
     *
     * @param ids ids
     * @return {@link Integer}
     */
    Integer removeBatch(List<Long> ids);

    /**
     * 更新
     *
     * @param deliveryOrder 交货订单
     * @return {@link Integer}
     */
    Integer update(DeliveryOrder deliveryOrder);

    /**
     * 收到分页
     *
     * @param deliveryOrderDto 交货订单dto
     * @return {@link List}<{@link DeliveryOrder}>
     */
    List<DeliveryOrder> getPage(DeliveryOrderDto deliveryOrderDto);

    /**
     * 获取总计
     *
     * @param deliveryOrderDto 交货订单dto
     * @return {@link Long}
     */
    Long getTotal(DeliveryOrderDto deliveryOrderDto);

    /**
     * 获取全部
     *
     * @return {@link List}<{@link DeliveryOrder}>
     */
    @Select("select * from delivery_order where is_deleted = 0;")
    List<DeliveryOrder> getAll();

    /**
     * 更具id获取
     *
     * @param id 编码
     * @return {@link DeliveryOrder}
     */
    @Select("select * from delivery_order where is_deleted = 0 and  id = #{id};")
    DeliveryOrder getById(Long id);
}
